<?php 
	header("content-type:text/html;charset=utf-8");
	$name = isset($_POST['name'])?$_POST['name']:"";
	$pwd = isset($_POST['pwd'])?$_POST['pwd']:"";
	$dsn = "mysql:host=127.0.0.1;dbname=07c;charset=utf8";
	$pdo = new PDO($dsn,'root','root');
	$sql = "insert into user(name,pwd) values('$name','$pwd')";
	//var_dump($sql);die;
	$res = $pdo->exec($sql);
	if($res){
		echo "<script>alert('添加成功');location.href='daochu.php'</script>";
	}else{
		echo "<script>alert('添加失败');location.href='form.php'</script>";
	}

 ?>